function fillNowArea(data, id) {
    
    for (var ele in data) {
        var eleData = data[ele].data;
        if (data[ele].type == 'tag') {
            $.each(eleData, function(index, eleTag) {
                $('#AREA' + id + 'x1' + ele).html('<button class="btn btn-primary uploadPicBtn" type="submit">上传图片</button><img src="' + eleTag.img + '"><p>' + eleTag.title + '</p>')
            })
        } else if (data[ele].type == 'ul') {
            $.each(eleData, function(index, eleLi) {
                
                $('#AREA' + id + 'x1' + ele + 'ul').append('<li class="ver-box-style"><button class="btn btn-primary uploadPicBtn" type="submit">上传图片</button><img src="' + eleLi.img + '"><p>' + eleLi.title + '</p></li>')
            })
        }
    }
};

function addHeadList(OneheightLight) {
     $("#p0y1ul").html('<li class="heightLight">' + OneheightLight + "</li>");
    return;
   var OneheightLight = '';
    switch(heightLineTag){
        case '001':OneheightLight = "首页";break;
        case '002':OneheightLight = "直播";break;
        case '003':OneheightLight = "点播";break;
        case '004':OneheightLight = "回看";break;
    }
    // console.log(OneheightLight)
//   getCollist2(OneheightLight);

  // $('#p0y1ul').html('<li>首页</li><li>点播</li><li>直播</li><li>回看</li>')
  // $('#p0y1ul li:eq('+heightLineTag+')').addClass('heightLight')
}

// 获取当前页面下栏目
function getCollist2(heightLineTag) {
    var collistId = 4;
    $('#secondMenu2 .dropdown-menu').empty()

    $.ajax({
        url: "/collists/4/columns",
        type: "get",
        async: true,
        success: function(data) {
            // console.log(data)
            if (data.status == 'success') {
                // console.log(data+'----getCollist2')
                /* var Datacontent = [{name: "首页", id: 14, title: "首页"},
                {name: "首页点播", id: 15, title: "点播"},
                {name: "首页直播", id: 15, title: "直播"},
                {name: "首页回看", id: 17, title: "回看"}] */
                $.each(data.content, function(ind, ele) {
                    // console.log(ele.title,heightLineTag)
                    if(ele.title == heightLineTag){
                        $('#p0y1ul').append('<li class="heightLight">'+ele.title+'</li>')
                        
                    }else{
                        
                        $('#p0y1ul').append('<li>'+ele.title+'</li>')
                    }
                })
                
            } else {
                layer.msg(data.content, {
                    icon: 5
                });
            }
        },
        error: function(data) {
            layer.msg("请求数据出错");
            
        }
    })
}

 /* 超出部分滚动效果 */
window.scroll_interval = null
window.scrollNode = null
/**
 * nowArea 当前选择的区域
 */
function scrollText(nowArea){
    // console.log(nowArea,'SCROLLTEXT');
    //设置全局滚动时间
    // console.log(nowArea)
    if(!nowArea) return;
    var scroll = $(nowArea).find('p')[0]
    var text = $(scroll).html();
    if ($(scroll).find("span").length == 0) {
        $(scroll).html("<span>" + text + "&nbsp;&nbsp;</span><span class='append_span'>" + text + "</span>");
    }
    var area_box_width = scroll.offsetWidth
    
    //当前文本宽度
    var div_area1 = $(scroll).find('span')[0]
    var div_area2 = $(scroll).find('.append_span')[0]

    if(div_area1.offsetWidth>=scroll.offsetWidth){
        $(div_area2).show();
        // var append_span = "<span class='append-span'>"+text+"</span>"
        // $(scroll).append(append_span)
        //超出区域滚动
        // console.log('滚动')
        scrollNode = scroll
        scroll_interval = setInterval(function() {
            // console.log(scroll)
            // console.log($(scroll))
            // console.log(div_area1.offsetWidth,scroll.scrollLeft)
            if (div_area1.offsetWidth <= scroll.scrollLeft) {
                
                scroll.scrollLeft -= div_area1.offsetWidth;
            } else {
                // console.log(scroll.scrollLeft,'>')
                scroll.scrollLeft += 2;
            }

        }, 50);

    } else {
        $(div_area2).hide();
    }
}
/* 停止滚动 */
function stopScrollText() {
    clearInterval(scroll_interval);
    if (scrollNode) {
        scrollNode.scrollLeft = 0;
        if($('.append_span')){
            $('.append_span').hide()
        }
    }
}